#include"UdpMediator.h"
#include"UdpNet.h"
UdpMediator::UdpMediator()
{
	m_pNet=new UdpNet(this); 
}
UdpMediator::~UdpMediator()
{
	if(m_pNet)
	{
		delete m_pNet;
		m_pNet=NULL;
	}

}


//打开网络
bool UdpMediator::OpenNet()
{
	if(m_pNet->InitNet())
	{
		return false;
	}

	return true;
}

//关闭网络
void UdpMediator::CloseNet()
{
	m_pNet->UnInitNet();
}

//发送数据
bool UdpMediator::SendData(long ISendIp,char* buf,int nLen)
{
	if(!m_pNet->SendData(ISendIp,buf,nLen))
	{
		return false;
	}
	return true;
}

//处理数据
#include<iostream>
void UdpMediator::DealData(long ISendIp,char* buf,int nLen)
{
	//把数据传给kernel类
	std::cout<<buf<<endl;
}


